package com.lgx.right.util;

import java.util.Random;

/**
 * 生成随机密码
 * @author ZHANGCHAO
 * 字母范围，大小写a-z
 * 数字范围，0-9
 */
public class PasswordUtils {
	


	/**
	 * 被调用的方法，生成随机密码
	 * @return
	 */
	public static String passwordRandom(){
		Random rnd = new Random();
		String str = "0123456789abcdefghijklmnopqrstuvwxyz";
		StringBuilder strBuilder = new StringBuilder();
		for(int i =0;i<8;i++){               //循环8次，产生8位密码
			int r = rnd.nextInt(36)-1;       //生成0-35的随机数（含35）
			strBuilder.append(str.charAt(r<0?0:r)); 
		}
		
		System.out.println("---------"+strBuilder.toString().trim());
		return strBuilder.toString().trim();
	}
	
	
}
